﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title>宾果高校</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/sweetalert.min.css" />
    <script src="../js/jquery-1.12.2.min.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/angular.min.js"></script>
    <script src="../js/Controller.js"></script>
    <script src="../js/sweetalert.min.js"></script>
</head>
<body id="bodyContent">
    <div id="searchPage"></div>
    <div class="main">
        <div class="wrap">
            <div class="panel panel-default">
                <div ng-app="myApp" class="panel-body">
                    <div class="togglebar">
                        <ul class="nav nav-tabs nav-justified">
                            <li class="active"><a id="popNotsellbox">自主下架</a></li>
                            <li><a id="popNotselledbox">已下架</a></li>
                        </ul>
                    </div>
                    <div style="margin-top: 5px;">
                        <div id="notsell-box">
                            <table ng-controller="selfCancelCtrl" class="table table-hover">
                                <tr>
                                    <td>社团活动书中的活动名称</td>
                                    <td>发布状态</td>
                                    <td>发布时间</td>
                                    <td>下架原因</td>
                                    <td>下架</td>
                                </tr>
                                <tr ng-repeat="x in names">
                                    <td>{{x.ProjectName}}</td>
                                    <td>{{x.Status=='1'?"发布中":"审核中"}}</td>
                                    <td>{{x.CreateTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                                    <td>
                                        <select class="form-control" id="ddlReason{{x.ProjectNO}}">
                                            <option value="900000034">活动信息错误</option>
                                            <option value="900000035">活动长时间没收到邀请</option>
                                            <option value="900000036">活动需要重新发布</option>
                                            <option value="900000037">活动已达成目的</option>
                                            <option value="900000038">活动时间过期</option>
                                            <option value="900000039">用户自主下架</option>
                                        </select>
                                    </td>
                                    <td>
                                        <button type="button" tag="{{x.ProjectNO}}" onclick="Go(this)" class="btn btn-default btn-xs">下架</button>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div id="notselled-box">
                            <table ng-controller="cancelledCtrl" class="table table-hover">
                                <tr>
                                    <td>社团活动书中的活动名称</td>
                                    <td>下架状态</td>
                                    <td>下架原因</td>
                                    <td>下架时间</td>
                                </tr>
                                <tr ng-repeat="x in names">
                                    <td>{{x.ProjectName}}</td>
                                    <td>{{x.Status=='5'?"已下架":"未下架"}}</td>
                                    <td>{{x.Remark}}</td>
                                    <td>{{x.UpdateTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                                </tr>
                            </table>
                        </div>
                        <div id="notsell-reason">
                            <table class="table">
                                <th>取消原因</th>
                                <form action="">
                                    <tr>
                                        <td>信息不匹配</td>
                                        <td>
                                            <input type="checkbox" value="">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>社团规模太小</td>
                                        <td>
                                            <input type="checkbox" value="">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>社团所在地不是所需地</td>
                                        <td>
                                            <input type="checkbox" value="">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>其它</td>
                                        <td>
                                            <input type="checkbox" value="">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center">
                                            <button type="submit" class="btn btn-default btn-xs">提交</button><a href="javascript:PAGE.fn.popClose('notsell-reason')" class="btn btn-default btn-xs">取消</a>
                                        </td>
                                    </tr>
                                </form>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script>

    //自主下架
    //由于当该社团活动书在达成合作的时刻，就会被系统自动下架。
    //所以在自助下架的界面显示的社团活动书其实是还没有达成合作的，且只有一条社团活动书

    //已下架
    //第一种：由于社团活动书只能有一条合同在身，所以当社团活动书在智慧搭配功能或企业赞助区或社团活动区三种情况中第一时间与企业达成合作共识得到了合同后，
    //那么所发布的社团活动书将自动下架
    //第二种：当社团活动书中的活动时间过期后，那么也将会自动下架。
    //第三种：是用户自己下架操作

    $("#searchPage").load("header.html", function () {
        SetCss("Act");
    });

    function AfteAjax(ctx) {
        if (ctx == "" || ctx == null) {
            common.alertMessage("提交错误，请重试！");
            return;
        }

        window.location = "notsell.html";
    }

    function Go(obj) {

        var id = $(obj).attr("tag");
        var reason = $("#ddlReason" + id).val();

        common.commonAjax({ type: 'get', url: '../api/project/CancelActivity?id=' + id + "&reason=" + reason, sMethod: AfteAjax, alert: true, loadingCtrl: $("#bodyContent") });
    }

</script>